import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_upgrade/flutter_upgrade.dart';
import 'package:flutter_upgrade/flutter_upgrade_platform_interface.dart';
import 'package:flutter_upgrade/flutter_upgrade_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockFlutterUpgradePlatform
    with MockPlatformInterfaceMixin
    implements FlutterUpgradePlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final FlutterUpgradePlatform initialPlatform = FlutterUpgradePlatform.instance;

  test('$MethodChannelFlutterUpgrade is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelFlutterUpgrade>());
  });

  test('getPlatformVersion', () async {
    FlutterUpgrade flutterUpgradePlugin = FlutterUpgrade();
    MockFlutterUpgradePlatform fakePlatform = MockFlutterUpgradePlatform();
    FlutterUpgradePlatform.instance = fakePlatform;

    expect(await flutterUpgradePlugin.getPlatformVersion(), '42');
  });
}
